package org.example.proxy.cglib;

import jdk.nashorn.internal.runtime.RewriteException;
import net.sf.cglib.proxy.CallbackFilter;
import org.example.proxy.anon.NoProxy;

import java.lang.reflect.Method;

/**
 * @author : RXK
 * Date : 2021/6/3 17:13
 * Code Less Think More
 * Desc:
 */
public class MethodFilter implements CallbackFilter {

    @Override
    public int accept(Method method) {
        if (method.getReturnType().equals(String.class)) {
            return 1;
        } else if (method.getReturnType().equals(int.class)) {
            return 3;
        }else if (method.isAnnotationPresent(NoProxy.class)){
            return 2;
        }
        return 0;
    }
}
